package org.tmall.utils;

public class PageBean {
	private int pageNo = 1; //当前页
	
	private int pageSize = 5; //每页显示的数据条数
	
	private int totalCount; //总条数
	
	private int totalPages; //总页数
	
	private int prevPage; //上一页
	
	private int nextPage; //下一页
	
	private int start; //开始条数
	
	private int end ;// 结束条数

	public int getPageNo() {
		return pageNo;
	}

	public void setPageNo(int pageNo) {
		this.pageNo = pageNo;
	}

	public int getPageSize() {
		return pageSize;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	public int getTotalCount() {
		return totalCount;
	}

	public void setTotalCount(int totalCount) {
		this.totalCount = totalCount;
	}

	public int getTotalPages() {
		this.totalPages = (this.totalCount - 1) / pageSize + 1;
		return totalPages;
	}

	public void setTotalPages(int totalPages) {
		this.totalPages = totalPages;
	}

	public int getPrevPage() {
		this.prevPage = pageNo <= 1 ? 1 : pageNo - 1;
		return prevPage;
	}

	public void setPrevPage(int prevPage) {
		this.prevPage = prevPage;
	}

	public int getNextPage() {
		nextPage = pageNo >= getTotalPages() ? totalPages : pageNo + 1;
		return nextPage;
	}

	public void setNextPage(int nextPage) {
		this.nextPage = nextPage;
	}

	public int getStart() {
		start = (pageNo - 1) * pageSize + 1;
		return start;
	}

	public void setStart(int start) {
		this.start = start;
	}

	public int getEnd() {
		end = pageNo == totalPages ? totalCount : pageNo * pageSize;
		return end;
	}

	public void setEnd(int end) {
		this.end = end;
	}
	
}
